// $Autor: joaocarlos e fernando $
// $Data: 07/08/2009 15:17:01 $
// $Revision: 1.3 $
//
// $Log: csadder.v $
// Revisao 1.1  07/08/2009 15:17:01  joaocarlos
// Carry out agora tem 32 bits
//
//


module carry_save_adder(a, b, cout, s, cin);
parameter SIZE = 32;
	input [SIZE-1:0] a;
	input [SIZE-1:0] b;
	input [SIZE-1:0] cin;
	output reg [SIZE-1:0] cout;
	output reg [SIZE-1:0] s;
	
	integer i;
	
	always@* begin
		for(i = 0; i <= SIZE-1; i=i + 1) begin
			s[i] = (a[i] ^ b[i]) ^ cin[i];
			cout[i] = (cin[i] & (a[i] | b[i])) | (a[i] & b[i]);
		end
	end
endmodule
